<template>
  <div class="event-share-container">
    <h2 class="page-title">天文事件分享</h2>
    
    <!-- 事件选择区域 -->
    <div class="section-card">
      <h3 class="section-title">选择天文事件</h3>
      <div class="event-selector">
        <label for="event-select">从近期事件中选择：</label>
        <select 
          id="event-select" 
          v-model="selectedEventId"
          @change="onEventSelected"
          class="event-dropdown"
        >
          <option value="">-- 请选择事件 --</option>
          <option 
            v-for="event in upcomingEvents" 
            :key="event.id" 
            :value="event.id"
          >
            {{ formatDate(event.date) }} - {{ event.title }}
          </option>
        </select>
      </div>
    </div>
    
    <!-- 事件详情预览 -->
    <div v-if="selectedEvent" class="section-card">
      <h3 class="section-title">事件详情</h3>
      <div class="event-preview">
        <div class="event-header">
          <h4 class="event-title">{{ selectedEvent.title }}</h4>
          <div class="event-type-badge">{{ getEventTypeLabel(selectedEvent.type) }}</div>
        </div>
        <div class="event-details">
          <div class="detail-item">
            <span class="detail-icon">📅</span>
            <span class="detail-label">发生时间:</span>
            <span class="detail-value">{{ formatDateTime(selectedEvent.date) }}</span>
          </div>
          <div class="detail-item">
            <span class="detail-icon">🌍</span>
            <span class="detail-label">可见范围:</span>
            <span class="detail-value">{{ selectedEvent.visibility }}</span>
          </div>
          <div class="detail-item">
            <span class="detail-icon">⏰</span>
            <span class="detail-label">最佳观测时间:</span>
            <span class="detail-value">{{ selectedEvent.bestTime }}</span>
          </div>
          <div v-if="selectedEvent.magnitude !== null" class="detail-item">
            <span class="detail-icon">🔆</span>
            <span class="detail-label">亮度:</span>
            <span class="detail-value">{{ selectedEvent.magnitude }} (等)</span>
          </div>
          <div class="event-description">
            <span class="detail-icon">📝</span>
            <span class="detail-label">事件描述:</span>
            <p class="detail-text">{{ selectedEvent.description }}</p>
          </div>
          <div class="event-tags">
            <span 
              v-for="tag in selectedEvent.tags" 
              :key="tag" 
              class="event-tag"
            >
              #{{ tag }}
            </span>
          </div>
        </div>
      </div>
    </div>
    
    <!-- 观测报告编辑区域 -->
    <div v-if="selectedEvent" class="section-card">
      <h3 class="section-title">编辑观测报告</h3>
      <div class="report-editor">
        <div class="editor-field">
          <label for="report-title">报告标题</label>
          <input 
            id="report-title" 
            v-model="reportData.title" 
            type="text" 
            placeholder="为您的观测报告取个标题" 
            class="editor-input"
          />
        </div>
        
        <div class="editor-field">
          <label for="observation-location">观测地点</label>
          <input 
            id="observation-location" 
            v-model="reportData.location" 
            type="text" 
            placeholder="输入您的观测地点" 
            class="editor-input"
          />
        </div>
        
        <div class="editor-field">
          <label for="observation-notes">观测记录</label>
          <textarea 
            id="observation-notes" 
            v-model="reportData.notes" 
            rows="6" 
            placeholder="记录您的观测体验、发现和感受..." 
            class="editor-textarea"
          ></textarea>
        </div>
        
        <div class="editor-field">
          <label for="equipment-used">使用设备</label>
          <input 
            id="equipment-used" 
            v-model="reportData.equipment" 
            type="text" 
            placeholder="记录您使用的望远镜、相机等设备" 
            class="editor-input"
          />
        </div>
        
        <div class="editor-field">
          <label>天气状况</label>
          <div class="weather-options">
            <label class="weather-option">
              <input type="radio" v-model="reportData.weather" value="晴朗" />
              <span class="weather-icon">☀️</span>
              <span>晴朗</span>
            </label>
            <label class="weather-option">
              <input type="radio" v-model="reportData.weather" value="多云" />
              <span class="weather-icon">☁️</span>
              <span>多云</span>
            </label>
            <label class="weather-option">
              <input type="radio" v-model="reportData.weather" value="有雾" />
              <span class="weather-icon">🌫️</span>
              <span>有雾</span>
            </label>
            <label class="weather-option">
              <input type="radio" v-model="reportData.weather" value="部分多云" />
              <span class="weather-icon">⛅</span>
              <span>部分多云</span>
            </label>
          </div>
        </div>
        
        <div class="editor-field">
          <label>观测体验评分</label>
          <div class="rating">
            <span 
              v-for="star in 5" 
              :key="star"
              class="star" 
              :class="{ 'active': reportData.rating >= star }"
              @click="setRating(star)"
            >
              ⭐
            </span>
            <span class="rating-text">{{ getRatingText(reportData.rating) }}</span>
          </div>
        </div>
        
        <!-- 图片上传 -->
        <div class="editor-field">
          <label for="image-upload">添加观测照片（可选）</label>
          <div class="image-upload-area">
            <input 
              id="image-upload" 
              type="file" 
              accept="image/*" 
              @change="handleImageUpload"
              class="image-input"
            />
            <div class="upload-placeholder">
              <span class="upload-icon">📷</span>
              <p>点击或拖拽图片到此处上传</p>
            </div>
            <div v-if="reportData.imagePreview" class="image-preview">
              <img :src="reportData.imagePreview" alt="观测照片预览" />
              <button @click="removeImage" class="remove-image-btn">移除</button>
            </div>
          </div>
        </div>
      </div>
    </div>
    
    <!-- 操作按钮 -->
    <div v-if="selectedEvent" class="action-buttons">
      <button 
        @click="generateReport" 
        :disabled="!canGenerateReport"
        class="generate-btn"
      >
        生成观测报告
      </button>
      <button 
        @click="shareReport" 
        :disabled="!isReportGenerated"
        class="share-btn"
      >
        分享观测报告
      </button>
    </div>
    
    <!-- 生成的报告预览 -->
    <div v-if="isReportGenerated" class="report-preview-container">
      <h3 class="section-title">观测报告预览</h3>
      <div class="report-preview">
        <div class="report-header">
          <h1 class="report-title">{{ reportData.title || '天文事件观测报告' }}</h1>
          <div class="report-date">生成时间：{{ new Date().toLocaleString() }}</div>
        </div>
        
        <div class="report-content">
          <div class="report-section">
            <h2>🔭 观测事件信息</h2>
            <div class="report-grid">
              <div class="report-item">
                <strong>事件名称：</strong>{{ selectedEvent.title }}
              </div>
              <div class="report-item">
                <strong>事件类型：</strong>{{ getEventTypeLabel(selectedEvent.type) }}
              </div>
              <div class="report-item">
                <strong>发生时间：</strong>{{ formatDateTime(selectedEvent.date) }}
              </div>
              <div class="report-item">
                <strong>可见范围：</strong>{{ selectedEvent.visibility }}
              </div>
            </div>
            <p class="event-description-report">{{ selectedEvent.description }}</p>
          </div>
          
          <div class="report-section">
            <h2>🌌 观测记录</h2>
            <div class="report-grid">
              <div class="report-item">
                <strong>观测地点：</strong>{{ reportData.location || '未提供' }}
              </div>
              <div class="report-item">
                <strong>使用设备：</strong>{{ reportData.equipment || '未提供' }}
              </div>
              <div class="report-item">
                <strong>天气状况：</strong>{{ reportData.weather || '未提供' }}
              </div>
              <div class="report-item">
                <strong>体验评分：</strong>{{ getRatingStars(reportData.rating) }}
              </div>
            </div>
            <p class="observation-notes">{{ reportData.notes || '暂无观测记录' }}</p>
          </div>
          
          <!-- 图片展示 -->
          <div v-if="reportData.imagePreview" class="report-section">
            <h2>📷 观测照片</h2>
            <div class="report-image-container">
              <img :src="reportData.imagePreview" alt="观测照片" class="report-image" />
            </div>
          </div>
          
          <!-- 生成建议和总结 -->
          <div class="report-section">
            <h2>💡 观测建议</h2>
            <ul class="observation-tips">
              <li v-for="tip in generatedTips" :key="tip" class="tip-item">
                {{ tip }}
              </li>
            </ul>
          </div>
        </div>
        
        <div class="report-footer">
          <p class="report-signature">由天文观测助手生成</p>
        </div>
      </div>
    </div>
    
    <!-- 分享模态框 -->
    <div v-if="showShareModal" class="modal-overlay" @click.self="closeShareModal">
      <div class="share-modal">
        <div class="modal-header">
          <h3>分享观测报告</h3>
          <button @click="closeShareModal" class="close-btn">✕</button>
        </div>
        <div class="modal-body">
          <div class="share-options">
            <div class="share-option">
              <div class="share-icon">📋</div>
              <div class="share-label">复制链接</div>
              <button @click="copyLink" class="share-btn-small">复制</button>
            </div>
            <div class="share-option">
              <div class="share-icon">📧</div>
              <div class="share-label">通过邮件分享</div>
              <button @click="shareByEmail" class="share-btn-small">分享</button>
            </div>
            <div class="share-option">
              <div class="share-icon">📱</div>
              <div class="share-label">保存为PDF</div>
              <button @click="downloadAsPDF" class="share-btn-small">下载</button>
            </div>
          </div>
          
          <div class="share-link-container">
            <label>分享链接：</label>
            <input 
              type="text" 
              :value="shareLink" 
              readonly 
              class="share-link-input"
            />
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { ref, computed, onMounted } from 'vue';
import { getUpcomingEvents, getEventById, getEventTypes } from '../data/astronomicalEvents';

export default {
  name: 'EventShare',
  setup() {
    // 状态管理
    const selectedEventId = ref('');
    const selectedEvent = ref(null);
    const upcomingEvents = ref([]);
    const isReportGenerated = ref(false);
    const showShareModal = ref(false);
    
    // 报告数据
    const reportData = ref({
      title: '',
      location: '',
      notes: '',
      equipment: '',
      weather: '',
      rating: 3,
      imagePreview: null,
      imageFile: null
    });
    
    // 计算属性
    const canGenerateReport = computed(() => {
      return selectedEvent.value && reportData.value.title && reportData.value.notes;
    });
    
    const shareLink = computed(() => {
      // 生成模拟的分享链接
      const baseUrl = window.location.origin;
      const reportId = `report_${new Date().getTime()}`;
      return `${baseUrl}/share/${reportId}`;
    });
    
    // 生成的观测建议
    const generatedTips = computed(() => {
      if (!selectedEvent.value) return [];
      
      const tips = [];
      const event = selectedEvent.value;
      
      // 基于事件类型生成建议
      if (event.type === 'meteor_shower') {
        tips.push('观测流星雨时，建议找一个远离城市灯光的地方，以获得最佳视野。');
        tips.push('准备一个躺椅可以让观测更加舒适，避免颈部疲劳。');
        tips.push('流星雨观测需要耐心，建议至少观测1-2小时以获得完整体验。');
      } else if (event.type.includes('eclipse')) {
        tips.push('观测日食时务必使用专业的日食眼镜，保护眼睛安全。');
        tips.push('月食观测不需要特殊设备，可以使用望远镜增强观测体验。');
        tips.push('准备相机记录这一难得的天文现象，但要注意曝光设置。');
      } else if (event.type.includes('planetary')) {
        tips.push('行星观测最好使用望远镜，小型望远镜即可看到基本细节。');
        tips.push('观测行星的最佳时间通常是在行星冲日期间。');
        tips.push('使用不同的滤镜可以增强行星表面特征的观测效果。');
      }
      
      // 基于天气状况添加建议
      if (reportData.value.weather === '多云') {
        tips.push('多云天气下，建议保持耐心，云层可能会暂时移动露出目标天体。');
      } else if (reportData.value.weather === '晴朗') {
        tips.push('晴朗的夜空是天文观测的理想条件，记得注意保暖和防蚊虫。');
      }
      
      // 通用建议
      tips.push('记录观测数据和体验感受，有助于积累观测经验。');
      tips.push('加入当地天文爱好者协会，分享观测经验和技巧。');
      
      return tips;
    });
    
    // 方法
    const loadUpcomingEvents = () => {
      // 获取未来60天的事件
      upcomingEvents.value = getUpcomingEvents(60);
    };
    
    const onEventSelected = () => {
      if (selectedEventId.value) {
        selectedEvent.value = getEventById(selectedEventId.value);
        // 自动生成报告标题
        reportData.value.title = `"${selectedEvent.value.title}" 观测报告`;
        isReportGenerated.value = false;
      } else {
        selectedEvent.value = null;
        isReportGenerated.value = false;
      }
    };
    
    const formatDate = (dateString) => {
      const date = new Date(dateString);
      return date.toLocaleDateString('zh-CN', { 
        year: 'numeric', 
        month: 'long', 
        day: 'numeric' 
      });
    };
    
    const formatDateTime = (dateString) => {
      const date = new Date(dateString);
      return date.toLocaleString('zh-CN', { 
        year: 'numeric', 
        month: 'long', 
        day: 'numeric',
        hour: '2-digit',
        minute: '2-digit'
      });
    };
    
    const getEventTypeLabel = (type) => {
      const typeNames = {
        'meteor_shower': '流星雨',
        'lunar_eclipse': '月食',
        'solar_eclipse': '日食',
        'planetary_opposition': '行星冲日',
        'planetary_configuration': '行星合日/大距',
        'conjunction': '天体合'
      };
      return typeNames[type] || type;
    };
    
    const setRating = (stars) => {
      reportData.value.rating = stars;
    };
    
    const getRatingText = (rating) => {
      const texts = ['很差', '较差', '一般', '良好', '优秀'];
      return texts[rating - 1] || '一般';
    };
    
    const getRatingStars = (rating) => {
      return '⭐'.repeat(rating);
    };
    
    const handleImageUpload = (event) => {
      const file = event.target.files[0];
      if (file) {
        // 检查文件类型
        if (!file.type.startsWith('image/')) {
          alert('请上传图片文件！');
          return;
        }
        
        // 检查文件大小
        if (file.size > 5 * 1024 * 1024) { // 5MB
          alert('图片大小不能超过5MB！');
          return;
        }
        
        // 预览图片
        const reader = new FileReader();
        reader.onload = (e) => {
          reportData.value.imagePreview = e.target.result;
          reportData.value.imageFile = file;
        };
        reader.readAsDataURL(file);
      }
    };
    
    const removeImage = () => {
      reportData.value.imagePreview = null;
      reportData.value.imageFile = null;
      document.getElementById('image-upload').value = '';
    };
    
    const generateReport = () => {
      if (!canGenerateReport.value) return;
      
      // 标记报告已生成
      isReportGenerated.value = true;
      
      // 存储报告到本地存储（模拟保存）
      const savedReports = JSON.parse(localStorage.getItem('savedReports') || '[]');
      const newReport = {
        id: Date.now(),
        eventId: selectedEvent.value.id,
        eventTitle: selectedEvent.value.title,
        reportData: { ...reportData.value },
        createdAt: new Date().toISOString()
      };
      savedReports.push(newReport);
      localStorage.setItem('savedReports', JSON.stringify(savedReports));
    };
    
    const shareReport = () => {
      showShareModal.value = true;
    };
    
    const closeShareModal = () => {
      showShareModal.value = false;
    };
    
    const copyLink = () => {
      const tempInput = document.createElement('input');
      tempInput.value = shareLink.value;
      document.body.appendChild(tempInput);
      tempInput.select();
      document.execCommand('copy');
      document.body.removeChild(tempInput);
      
      // 显示复制成功提示
      alert('链接已复制到剪贴板！');
    };
    
    const shareByEmail = () => {
      const subject = encodeURIComponent(`天文观测报告: ${reportData.value.title}`);
      const body = encodeURIComponent(`我分享了一份天文观测报告:\n\n报告标题: ${reportData.value.title}\n事件: ${selectedEvent.value.title}\n\n查看完整报告: ${shareLink.value}`);
      
      window.location.href = `mailto:?subject=${subject}&body=${body}`;
    };
    
    const downloadAsPDF = () => {
      // 在实际应用中，这里应该调用PDF生成库
      // 这里模拟下载功能
      alert('PDF生成功能将在后续版本中实现！');
    };
    
    // 初始化
    onMounted(() => {
      loadUpcomingEvents();
    });
    
    return {
      selectedEventId,
      selectedEvent,
      upcomingEvents,
      reportData,
      isReportGenerated,
      showShareModal,
      canGenerateReport,
      shareLink,
      generatedTips,
      onEventSelected,
      formatDate,
      formatDateTime,
      getEventTypeLabel,
      setRating,
      getRatingText,
      getRatingStars,
      handleImageUpload,
      removeImage,
      generateReport,
      shareReport,
      closeShareModal,
      copyLink,
      shareByEmail,
      downloadAsPDF
    };
  }
};
</script>

<style scoped>
.event-share-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.page-title {
  text-align: center;
  font-size: 2rem;
  color: var(--text-primary);
  margin-bottom: 2rem;
}

.section-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.section-title {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-top: 0;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-color);
}

/* 事件选择器样式 */
.event-selector {
  margin-bottom: 1rem;
}

.event-selector label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.event-dropdown {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

.event-dropdown:focus {
  outline: none;
  border-color: var(--accent-color);
}

/* 事件预览样式 */
.event-preview {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 1rem;
}

.event-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.event-title {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin: 0;
}

.event-type-badge {
  background: var(--accent-color);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
}

.event-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.detail-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.detail-icon {
  font-size: 1.25rem;
  margin-right: 0.25rem;
}

.detail-label {
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 100px;
}

.detail-value, .detail-text {
  color: var(--text-primary);
  margin: 0;
  flex: 1;
}

.event-description {
  flex-direction: column;
}

.event-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.event-tag {
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent-color);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.875rem;
}

/* 报告编辑器样式 */
.report-editor {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.editor-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.editor-field label {
  font-weight: 600;
  color: var(--text-primary);
}

.editor-input, .editor-textarea {
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.editor-input:focus, .editor-textarea:focus {
  outline: none;
  border-color: var(--accent-color);
}

.editor-textarea {
  resize: vertical;
  min-height: 120px;
}

.weather-options {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.weather-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: background-color 0.3s ease;
}

.weather-option:hover {
  background: var(--bg-secondary);
}

.weather-icon {
  font-size: 1.25rem;
}

.rating {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.star {
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.star:hover {
  transform: scale(1.2);
}

.star.active {
  color: #ffd700;
}

.rating-text {
  margin-left: 0.5rem;
  color: var(--text-secondary);
}

/* 图片上传样式 */
.image-upload-area {
  position: relative;
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.image-upload-area:hover {
  border-color: var(--accent-color);
  background: rgba(var(--accent-rgb), 0.05);
}

.image-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.upload-icon {
  font-size: 3rem;
}

.upload-placeholder p {
  margin: 0;
  color: var(--text-secondary);
}

.image-preview {
  position: relative;
  max-width: 300px;
  margin: 0 auto;
}

.image-preview img {
  max-width: 100%;
  border-radius: 8px;
}

.remove-image-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  background: #ff4757;
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  transition: background-color 0.3s ease;
}

.remove-image-btn:hover {
  background: #ff3742;
}

/* 操作按钮样式 */
.action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.generate-btn, .share-btn {
  padding: 0.75rem 2rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.generate-btn {
  background: var(--accent-color);
  color: white;
}

.generate-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
}

.share-btn {
  background: #4834d4;
  color: white;
}

.share-btn:hover:not(:disabled) {
  background: #3742fa;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(72, 52, 212, 0.3);
}

.generate-btn:disabled, .share-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 报告预览样式 */
.report-preview-container {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.report-preview {
  background: white;
  border-radius: 8px;
  padding: 2rem;
  color: #333;
}

.report-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #eee;
}

.report-title {
  font-size: 1.75rem;
  color: #121e3e;
  margin: 0 0 0.5rem 0;
}

.report-date {
  color: #666;
  font-size: 0.875rem;
}

.report-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.report-section h2 {
  font-size: 1.25rem;
  color: #121e3e;
  margin-top: 0;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.report-item {
  background: #f8f9fa;
  padding: 0.75rem;
  border-radius: 8px;
}

.event-description-report {
  line-height: 1.6;
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 0;
}

.observation-notes {
  line-height: 1.6;
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 0;
  min-height: 100px;
}

.report-image-container {
  text-align: center;
  margin-bottom: 1rem;
}

.report-image {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.observation-tips {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tip-item {
  background: #e3f2fd;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  border-radius: 8px;
  border-left: 4px solid #2196f3;
}

.tip-item:last-child {
  margin-bottom: 0;
}

.report-footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 2px solid #eee;
  color: #666;
  font-size: 0.875rem;
}

/* 分享模态框样式 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.share-modal {
  background: var(--bg-card);
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.close-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
}

.share-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.share-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.share-option:hover {
  background: rgba(var(--accent-rgb), 0.1);
  transform: translateY(-2px);
}

.share-icon {
  font-size: 2rem;
}

.share-label {
  font-size: 0.875rem;
  color: var(--text-primary);
}

.share-btn-small {
  margin-top: 0.5rem;
  padding: 0.25rem 0.75rem;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.share-btn-small:hover {
  background: var(--accent-hover);
}

.share-link-container {
  margin-top: 1rem;
}

.share-link-container label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.share-link-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .event-share-container {
    padding: 1rem;
  }
  
  .page-title {
    font-size: 1.5rem;
  }
  
  .section-card {
    padding: 1rem;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .report-grid {
    grid-template-columns: 1fr;
  }
  
  .share-options {
    grid-template-columns: 1fr;
  }
  
  .weather-options {
    flex-direction: column;
  }
  
  .report-preview {
    padding: 1rem;
  }
}
</style>